#ifndef CSINGLETON_H
#define CSINGLETON_H


template<typename CLASS> 
class CSingleTon
{
private:
	static CLASS* Instance;
	CSingleTon(CSingleTon&);
	void operator =(CSingleTon&);
protected:
	CSingleTon(){}
	~CSingleTon()
	{
		if (Instance != 0)
		{
			delete Instance;
			Instance = NULL;
		}
	}
public:
	static CLASS* GetInstance()
	{
		if (Instance == NULL)
		{
			Instance = new CLASS;
			
		}
		return(Instance);
	}
	static void Destroy()
	{
		if (Instance != 0)
		{
			delete Instance;
			Instance = NULL;
		}
	}
};
template <typename CLASS> CLASS* CSingleTon<CLASS>::Instance = NULL;
#endif